# coding: utf8
# datetime: 2021-04-03
# 题目地址: https://leetcode-cn.com/problems/rabbits-in-forest/


from typing import List


class Solution:
    def numRabbits(self, answers: List[int]) -> int:
        # 去重
        answer_set = set(answers)
        ret = 0
        for answer in answer_set:
            count = answers.count(answer)
            if answer == 0:
                ret += count
            else:
                an_num = count/(answer+1)
                an_num = int(an_num) if an_num == int(an_num) else int(an_num)+1
                ret += an_num*(answer+1)

        return ret


a = Solution()
print(a.numRabbits([10,10,10]))